home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2255 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: nntp.atlanta.com!not-for-mail
  2. From: curts@compgen.com (Curt Smith)
  3. Newsgroups: comp.lang.c++,comp.protocols.tcp-ip
  4. Subject: Re: Socket classes and fork()
  5. Followup-To: comp.lang.c++,comp.protocols.tcp-ip
  6. Date: 16 Jan 1996 19:11:30 GMT
  7. Organization: Internet Atlanta
  8. Message-ID: <4dgt92$o7e@nntp.atlanta.com>
  9. References: <1996Jan15.192235.21245@etnibsd.uucp>
  10. NNTP-Posting-Host: gw1.compgen.com
  11. X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]
  12.  
  13. Sandeep Pathak (sandeep@etnibsd.uucp) wrote:
  14. : Hi netters,
  15. : My apologies if this is a repost. I wasnt sure my first posting went thru.
  16. : I am writing simple C++ classes/wrappers for sockets and related 
  17. : networking abstractions. I have modeled my classes mostly on the 
  18. : traditional structures and function calls, but I got stumped by "fork()". 
  19. : My Socket class also has a reference count similar to that maintained 
  20. : by the kernel for a socket descriptor. But how do I maintain this count
  21. : if a fork() is done? I can not think of anyway of maintaining 
  22. : consistency w/ the kernel count unless there is some parent <-> child 
  23. : IPC for the Socket object. Anybody want to share some experiences?..
  24. : I am sure there are a lot of people who have written/dealt w/ C++ 
  25. : wrappers for IPC and networking.
  26. : At this point (without some research) I would lamely contend that my 
  27. : Socket abstraction will not be in a proper state if concurrent servers 
  28. : are written w/ it.
  29. : Please prove me wrong..!
  30.  
  31. You are correct.  Although tools like; fuser, and lsof access the
  32. per process and kernel data structures to sniff all PIDs that have
  33. an fd open.  You can code the same, to snoop, for other PIDs with this
  34. fd.  It is a pain and is CPU and real time expensive to open and 
  35. prob /proc/* or /dev/kmem and largely this code will be OS dependant.
  36.  
  37. -- 
  38.  
  39. Curt Smith
  40. curts@compgen.com
  41.  
  42.